package com.firewolf.springcloud.service;

import com.firewolf.springcloud.pojo.User;
import com.firewolf.springcloud.service.hystrix.UserServiceFail;
import com.firewolf.springcloud.vo.ResponseVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;

/**
 * 作者：刘兴
 * 时间:19/2/14
 **/

/**
 * provider 是注册到eureka上面的服务的名字
 */
@FeignClient(value = "provider",path = "/user",fallback = UserServiceFail.class)
public interface UserService {
    @GetMapping("/b") //这里的URL应该对应生产者的url，
    List<User> findUsers();


    /**
     * Post传递对象
     * @param user
     * @return
     */
    @PostMapping
    public ResponseVO add1(User user);

    @PostMapping("/a")
    public ResponseVO add2(@RequestParam("id") Integer uid, @RequestParam("uname") String name);


    @GetMapping("/b")
    public List<User> get();

    @GetMapping("/c")
    public List<User> get(User u);

    @GetMapping("/d")
    public List<User> get(@RequestParam("id") Integer uid, @RequestParam("uname") String name);

    //占位符传参
    @DeleteMapping("/e/{id}/xxx/{name}")
    public ResponseVO delete(@PathVariable("id") Integer uid,@PathVariable("name") String uname);
}
